package se137.hrbust.hlgshopping137.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import se137.hrbust.hlgshopping137.entity.PCTreeNode137;
import se137.hrbust.hlgshopping137.entity.PCategroy137;
import se137.hrbust.hlgshopping137.service.PCategroyService137;
import se137.hrbust.hlgshopping137.utils.Result137;

import java.util.List;

@RestController
@RequestMapping("/category")
public class PCategoryController137 {
    @Autowired

    PCategroyService137 pservice137;
    @GetMapping("/{id}")
  public Result137 findCategroyById137(@PathVariable int id) {
        Result137 r=new Result137();
        r.setCode(200);
        r.setMsg("success");
        r.setData(pservice137.findCategroyById137(id));
        return r;
    }
    @RequestMapping("/pclist/{pcId}")
    public Result137 pcList(@PathVariable("pcId") int pcId) {
       Result137 r=new Result137();
        System.out.println(pcId);
        return  r.ok(pservice137.getPCTreeList137(pcId));
    }
}
